<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
  <meta name="viewport"
    content="width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=0 , viewport-fit=cover">
  <meta name="theme-color" content="#000000" />
  <meta name="description" content="Web site created using create-react-app" />
  <style>
    .iphonex-block {
      background-color: transparent;
      height: constant(safe-area-inset-bottom);
      height: env(safe-area-inset-bottom);
      width: 100%;
      position: fixed;
      bottom: 0;
    }

    #root {
      margin-bottom: env(safe-area-inset-bottom);
    }
  </style>
  <title></title>
</head>

<body style="position: unset;">
  <noscript>You need to enable JavaScript to run this app.</noscript>
  <div id="root"></div>
  <div class="iphonex-block">

  </div>
  <div id="notices"> </div>
  <div id="jiantong"> </div>

  <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  <script
    src="https://webapi.amap.com/maps?v=1.4.15&key=294e2d30cd2ed459739d42dc38de6a58&plugin=AMap.Autocomplete,AMap.PlaceSearch,AMap.ToolBar"></script>
  <script src=" //webapi.amap.com/ui/1.1/main.js?v=1.1.1"></script>

  <script>

    /**
     * @description: 跳转到微信小程序支付
     * @param {*}
     * @return {*}
     */
    function weiChartAppletPay(payParam) {
      console.log('weiChart:', payParam)
      const { orderno, tuanid, uniacid, realPrice, successUrl, failUrl, weikuanSuccessUrl } = payParam
      wx.miniProgram.navigateTo({
        url: `/pages/pay/pay?orderno=${orderno}&tuanid=${tuanid}&uniacid=${uniacid}
        &realPrice=${realPrice}&success=${successUrl}&fail=${failUrl}
        &weikuanSuccessUrl=${weikuanSuccessUrl}
        `,
        success: function (res) {
          return 'success'
        },
        fail: function (res) {
          return 'fail'
        },
        complete: function (res) {
          return 'complete'
        }
      })
      return 'unApplet'
    }

    function navigateToWebWiew(replaceHash) {
      // 小程序页面跳转

      replaceHash = '#' + replaceHash
      const nowHash = window.location.hash
      let webwiewUrl = window.location.href.replace(nowHash, replaceHash)

      // 保留
      if (webwiewUrl.search(/(goodsid|groupid)/) > 0) {
        const reg = new RegExp('(^|&)(goodsid|groupid)=([^&]*)(&|$)', 'i')
        webwiewUrl = webwiewUrl.replace(reg, `&`)
      }

      localStorage.removeItem('shareParams')  // 被分享者进入对应页面后移除 缓存


      if (replaceHash === '/') { // 如果回到首页销毁前一页
        wx.miniProgram.redirectTo({
          url: `/pages/nextview/nextview?url=${encodeURIComponent(webwiewUrl)}`,
          success: function (res) {
            console.log(res, 'success')
          },
          fail: function (res) {
            console.log(res, 'fail')
          },
          complete: function (res) {
            console.log(res, 'complete')
          }
        })
      } else {
        wx.miniProgram.navigateTo({
          url: `/pages/nextview/nextview?url=${encodeURIComponent(webwiewUrl)}`,
          success: function (res) {
            console.log(res, 'success')
          },
          fail: function (res) {
            console.log(res, 'fail')
          },
          complete: function (res) {
            console.log(res, 'complete')
          }
        })
      }

    }

    function goLogin() {
      wx.miniProgram.navigateTo({
        url: '/pages/home-login/main'
      })
    }

    function goAppletPage(targetPageName) {
      wx.miniProgram.redirectTo({
        url: targetPageName,
        success: function (res) {
          console.log('success')
        },
        fail: function () {
          console.log('fail');
        },
        complete: function () {
          console.log('complete')
        }
      })
    }

    function goPage(page) {
      wx.miniProgram.redirectTo({
        url: page,
        success: function (res) {
          console.log('success')
        },
        fail: function () {
          console.log('fail');
        },
        complete: function () {
          console.log('complete')
        }
      })
    }

    function goService() {
      wx.miniProgram.navigateTo({
        url: '/pages/service/service',
        success: function (res) {
          console.log('success')
        },
        fail: function () {
          console.log('fail');
        },
        complete: function () {
          console.log('complete')
        }
      })
    }

    function navigateGoBack() {
      wx.miniProgram.navigateBack()
    }

  </script>

</body>

</html>